package com.bicon.base.data.controller.system.user;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import com.bicon.base.data.common.util.SystemConfig;
import com.bicon.base.data.framework.web.controller.BaseController;
import com.bicon.base.data.pojo.system.menu.Menu;
import com.bicon.base.data.pojo.system.user.User;
import com.bicon.base.data.service.system.menu.IMenuService;

/**
 * 首页 业务处理
 * 
 * @author zhoutianqi
 */
@Controller
public class IndexController extends BaseController
{
	private String prefix = "system/message";
	
    @Autowired
    private IMenuService menuService;

    @Autowired
    private SystemConfig ruoYiConfig;

    // 系统首页
    @GetMapping("/index")
    public String index(Model model)
    {
        // 取身份信息
        User user = getUser();
        // 根据用户id取出菜单
        List<Menu> menus = menuService.selectMenusByUserId(user.getUserId());
        model.addAttribute("menus", menus);
        model.addAttribute("user", user);
        model.addAttribute("copyrightYear", ruoYiConfig.getCopyrightYear());
        return "index";
    }

    
    // 系统消息
    @GetMapping("/system/main")
    public String main(Model model)
    {
        return prefix + "/message";
    }

}
